<style>
    .layui-top-box {padding:40px 20px 20px 20px;color:#fff}
    .panel {margin-bottom:17px;background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}
    .panel-body {padding:15px}
    .panel-title {margin-top:0;margin-bottom:0;font-size:14px;color:inherit}
    .label {display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;margin-top: .3em;}
    .layui-red {color:red}
    .main_btn > p {height:40px;}
</style>
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main layui-top-box">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md3">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-cyan">
                        <div class="panel-body">
                            <div class="panel-title">
                                <span class="label pull-right layui-bg-blue">实时</span>
                                <h5>租客人数统计</h5>
                            </div>
                            <div class="panel-content">
                                <h1 class="no-margins"><span id="kh"></span></h1>
                                <div class="stat-percent font-bold text-gray"></div>
                                <small>来自全部在线客户</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md3">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-blue">
                        <div class="panel-body">
                            <div class="panel-title">
                                <span class="label pull-right layui-bg-cyan">实时</span>
                                <h5>房屋统计</h5>
                            </div>
                            <div class="panel-content">
                                <h1 class="no-margins"><span id="fz"></span></h1>
                                <div class="stat-percent font-bold text-gray"></div>
                                <small>当前分类总记录数</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md3">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-green">
                        <div class="panel-body">
                            <div class="panel-title">
                                <span class="label pull-right layui-bg-orange">实时</span>
                                <h5>公告</h5>
                            </div>
                            <div class="panel-content">
                                <h1 class="no-margins"><span id="gg"></span></h1>
                                <div class="stat-percent font-bold text-gray"></div>
                                <small>当前分类总记录数</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md3">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-orange">
                        <div class="panel-body">
                            <div class="panel-title">
                                <span class="label pull-right layui-bg-green">实时</span>
                                <h5>维修统计</h5>
                            </div>
                            <div class="panel-content">
                                <h1 class="no-margins"><span id="wx"></span></h1>
                                <div class="stat-percent font-bold text-gray"></div>
                                <small>当前分类总记录数</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script type="text/html" id="testTpl">
      {{# for(var i=0;i< d.list.length;i++){ }}
        <li class="layui-timeline-item">
            <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
            <div class="layui-timeline-content layui-text">
                <h3 class="layui-timeline-title">{{ d.list[i].date }}</h3>
                <p>
                    {{ d.list[i].content }}
                </p>
            </div>
        </li>
      {{# } }}

        <li class="layui-timeline-item">
            <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
            <div class="layui-timeline-content layui-text">
                <div class="layui-timeline-title">过去</div>
            </div>
        </li>
    </script>

    <div class="layui-col-md18" >
        <ul class="layui-timeline">

             <div id="testDiv"></div>

        </ul>
    </div>
</div>
</div>
</div>
<script>
    layui.use('laytpl',function(){
        var $ = layui.jquery,
            laytpl = layui.laytpl;

        $.ajax({
            url:SURL+'index/queryIndexTongji',
            dataType:'json',
            type:'post',
            success:function(data){
                $('#kh').html(data.khCount);
                $('#gg').html(data.ggCount);
                $('#fz').html(data.fzCount);
                $('#wx').html(data.wxCount);
            }
        });
        //遍历公告数据
        $.ajax({
            url:SURL+'index/queryNoticeAll',
            dataType:'json',
            type:'post',
            success:function(res){
                var gettpl=document.getElementById("testTpl").innerHTML;
                laytpl(gettpl).render(res,function(html){
                      document.getElementById("testDiv").innerHTML=html;
                })
            }
        })

    })
</script>


